load("@bazel_gomock//:gomock.bzl", "gomock")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "rangefeed",
    srcs = [
        "config.go",
        "db_adapter.go",
        "doc.go",
        "rangefeed.go",
        "scanner.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvclient/rangefeed",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/ctxgroup",
        "//pkg/util/hlc",
        "//pkg/util/limit",
        "//pkg/util/log",
        "//pkg/util/mon",
        "//pkg/util/retry",
        "//pkg/util/span",
        "//pkg/util/stop",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_logtags//:logtags",
        "@com_github_cockroachdb_redact//:redact",
    ],
)

gomock(
    name = "mock_rangefeed",
    out = "mocks_generated_test.go",
    interfaces = ["DB"],
    library = ":rangefeed",
    package = "rangefeed",
    self_package = "github.com/cockroachdb/cockroach/pkg/kv/kvclient/rangefeed",
    visibility = [
        ":__pkg__",
        "//pkg/gen:__pkg__",
    ],
)

go_test(
    name = "rangefeed_test",
    srcs = [
        "db_adapter_external_test.go",
        "helpers_test.go",
        "main_test.go",
        "rangefeed_external_test.go",
        "rangefeed_mock_test.go",
        ":mock_rangefeed",  # keep
    ],
    embed = [":rangefeed"],
    deps = [
        "//pkg/base",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/closedts",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/roachpb",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/spanconfig/spanconfigptsreader",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/storage",
        "//pkg/testutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/storageutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/ctxgroup",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/metamorphic",
        "//pkg/util/mon",
        "//pkg/util/randutil",
        "//pkg/util/retry",
        "//pkg/util/span",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_golang_mock//gomock",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
    ],
)
